<template>
  <a-card :bordered="false">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
          <a-col :xl="12" :lg="12" :md="12" :sm="24">
            <a-form-item label="类目">
              <div style="display:flex;align-items: center;">
                <a-select v-model="queryParam.categoryId1" placeholder="请选择一级经营类目" @change="getcategoryId2sChange">
                  <a-select-option v-for="(item,index) in categoryId1s" :key="index" :value="item.id">
                    {{ item.name }}
                  </a-select-option>
                </a-select>
                <a-divider type="vertical"/>
                <a-select v-model="queryParam.categoryId2" placeholder="请选择二级经营类目" @change="getcategoryId3sChange">
                  <a-select-option v-for="(item,index) in categoryId2s" :key="index" :value="item.id">
                    {{ item.name }}
                  </a-select-option>
                </a-select>
                <a-divider type="vertical"/>
                <a-select v-model="queryParam.categoryId3" placeholder="请选择三级经营类目">
                  <a-select-option v-for="(item,index) in categoryId3s" :key="index" :value="item.id">
                    {{ item.name }}
                  </a-select-option>
                </a-select>
              </div>
            </a-form-item>
          </a-col>

          <a-col :xl="12" :lg="12" :md="12" :sm="24">
            <a-form-item label="分类">
              <div style="display:flex;align-items: center;">
                <a-select v-model="queryParam.pcategoryId" placeholder="请选择一级分类" @change="getcateId2sChange">
                  <a-select-option v-for="(item,index) in cateId1s" :key="index" :value="item.id">
                    {{ item.name }}
                  </a-select-option>
                </a-select>
                <a-divider type="vertical"/>
                <a-select v-model="queryParam.categoryId" placeholder="请选择二级分类">
                  <a-select-option v-for="(item,index) in cateId2s" :key="index" :value="item.id">
                    {{ item.name }}
                  </a-select-option>
                </a-select>
              </div>
            </a-form-item>
          </a-col>

          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="商品标题">
              <a-input placeholder="请输入商品标题" v-model="queryParam.title"></a-input>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="商品货号">
              <a-input placeholder="请输入商品货号" v-model="queryParam.code"></a-input>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="供应商">
              <a-input placeholder="请输入供应商" v-model="queryParam.supplierName"></a-input>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="创建时间">
              <j-date placeholder="请选择创建时间" style="width:100%;" v-model="queryParam.createTime"></j-date>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="是否参与分销">
              <j-dict-select-tag v-model="queryParam.isCommission" placeholder="全部" dictCode="yn"
                                 @change="searchQuery"/>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
              <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
              <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
            </span>
          </a-col>
        </a-row>
      </a-form>
    </div>
    <!-- 查询区域-END -->

    <!-- 操作按钮区域 -->
    <div class="table-operator">

      <a-radio-group :default-value="null" v-model="queryParam.status" @change="searchQuery" button-style="solid">
        <a-radio-button :value="null">
          全部
        </a-radio-button>
        <a-radio-button :value="1">
          上架中
        </a-radio-button>
        <a-radio-button :value="0">
          下架中
        </a-radio-button>
        <a-radio-button :value="2">
          仓库中
        </a-radio-button>
        <a-radio-button v-if="sysMode!=1" :value="3">
          待审核
        </a-radio-button>
        <a-radio-button v-if="sysMode!=1" :value="4">
          审核拒绝
        </a-radio-button>
      </a-radio-group>
      <a-divider type="vertical"/>
      <a-button @click="handlePageAdd" type="primary" icon="plus">新增</a-button>

      <!--      <a-upload name="file" :showUploadList="false" :multiple="false" :headers="importHeader"
                      :action="importExcelUrlSimple"
                      @change="handleImportExcel">
              <a-button type="primary" icon="import">商品导入</a-button>
            </a-upload>-->

      <span v-if="selectedRowKeys.length > 0">
        <a-button v-if="shopType==1" @click="labelEditBatch()">
          批量添加标签
        </a-button>
        <a-button v-if="(queryParam.status==0||queryParam.status==2)&&shopType!=4" @click="batchStatusChange(1,'上架')">
          批量上架
        </a-button>
        <a-button v-if="queryParam.status==1" @click="batchStatusChange(0,'下架')">
          批量下架
        </a-button>
        <a-button
          v-if="(queryParam.status==4&&(shopType==3||shopType==4))||((queryParam.status==0||queryParam.status==2)&&shopType==4)"
          @click="batchStatusChange(3,'提交审核')">
          批量提交审核
        </a-button>
        <a-button v-if="queryParam.status==3&&shopType==1" @click="batchStatusChange(1,'审核通过')">
          批量通过审核
        </a-button>
        <a-button v-if="queryParam.status==3&&shopType==1" @click="batchStatusChange(4,'拒绝通过')">
          批量拒绝通过
        </a-button>
        <a-button v-if="queryParam.status==0&&shopType!=1" @click="batchDel">
          批量删除
        </a-button>

      </span>
    </div>

    <!-- table区域-begin -->
    <div>
      <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
        <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a
        style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
        <a style="margin-left: 24px" @click="onClearSelected">清空</a>
      </div>

      <a-table ref="table" size="middle" :scroll="{x:true}" bordered rowKey="id" :columns="columns"
               :dataSource="dataSource" :pagination="ipagination"
               :loading="loading" :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
               class="j-table-force-nowrap"
               @change="handleTableChange">

        <template slot="labelSlot" slot-scope="text,record">
          <div v-for="(item,index) in record.labelNamesList" :key="index" style="padding-bottom:2px;">
            <a-tag color="blue">
              {{ item }}
            </a-tag>
          </div>
        </template>
        <template slot="htmlSlot" slot-scope="text">
          <div v-html="text"></div>
        </template>
        <template slot="numToFixed2Slot" slot-scope="text">
          {{ text|numToFixed2 }}
        </template>
        <template slot="sequence" slot-scope="text">
          <div>
            {{ text }}
          </div>
        </template>
        <template slot="rate" slot-scope="text,record">
          <div v-if="record.isCommission == 1">
            {{ text }}
          </div>
          <div v-else>
            {{ text }}
          </div>
        </template>
        <template slot="titleSlot" slot-scope="text">
          <div style="width:200px;white-space: normal;word-break: break-all;word-wrap: break-word;line-height:20px;">
            {{ text }}
          </div>
        </template>

        <template slot="imgSlot" slot-scope="text">
          <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
          <img v-else :src="getImgView(text)" @click="openUrlView(text)" height="55px" alt=""
               style="max-width:80px;font-size: 12px;font-style: italic;"/>
        </template>
        <template slot="statusSlot" slot-scope="text">
          <a-tag color="pink" v-if="text==3">
            待审核
          </a-tag>
          <a-tag color="red" v-if="text==4">
            审核拒绝
          </a-tag>
          <a-tag color="orange" v-if="text==2">
            仓库中
          </a-tag>
          <a-tag color="green" v-if="text==1">
            上架中
          </a-tag>
          <a-tag color="cyan" v-if="text==0">
            下架中
          </a-tag>
        </template>

        <span slot="action" slot-scope="text, record">
          <!-- <a v-if="record.sequence>1" @click="handleTop(record)">置顶</a>
          <br v-if="record.sequence>1" />
          <a v-if="record.sequence==1" @click="handleCancelTop(record)">取消置顶</a>
          <br v-if="record.sequence==1" /> -->
          <a @click="handlePageEdit(record)">编辑</a>
            <a-divider type="vertical"/>
          <a-dropdown>
            <a class="ant-dropdown-link">更多
              <a-icon type="down"/>
            </a>
            <a-menu slot="overlay">
              <a-menu-item>
                <a @click="handlePageDetail(record)">详情</a>
              </a-menu-item>
              <a-menu-item>
                <a @click="labelEdit(record)">标签编辑</a>
              </a-menu-item>
              <a-menu-item v-if="record.isCommission == 1">
                <a @click="discountEdit(record)">分佣配置</a>
              </a-menu-item>
              <a-menu-item>
                <a @click="natureEdit(record)">服务描述</a>
              </a-menu-item>
              <!-- <a-menu-item>
                <a @click="remEdit(record)">关联商品推荐</a>
              </a-menu-item> -->
              <a-menu-item v-if="record.status==0&&shopType!=4">
                <a @click="statusChange(1,record.id,'上架')">上架</a>
              </a-menu-item>
              <a-menu-item v-if="record.status==1">
                <a @click="statusChange(0,record.id,'下架')">下架</a>
              </a-menu-item>
              <a-menu-item
                v-if="(record.status==4&&(shopType==3||shopType==4))||((record.status==2&&record.status==2)&&shopType==4)">
                <a @click="statusChange(3,record.id,'提交审核')">提交审核</a>
              </a-menu-item>
              <a-menu-item v-if="record.status==3&&shopType==1">
                <a @click="statusChange(1,record.id,'通过审核')">通过审核</a>
              </a-menu-item>
              <a-menu-item v-if="record.status==3&&shopType==1">
                <a @click="statusChange(4,record.id,'拒绝通过')">拒绝通过</a>
              </a-menu-item>
              <a-menu-item v-if="record.status==2&&(shopType!=1||(shopType==1&&!record.supplierName))">
                  <a @click="deleteGoods(record)">删除</a>
              </a-menu-item>
            </a-menu>
          </a-dropdown>
        </span>

      </a-table>
    </div>

    <gms-good-modal ref="modalForm" @ok="modalFormOk"></gms-good-modal>
    <gms-label-ref ref="modalLabels" :selectionType="'checkbox'" @ok="modalLabelOk"></gms-label-ref>
    <gms-range-info ref="rangeDiscount"></gms-range-info>
    <gms-good-nature-ref ref="modalNatures" :selectionType="'checkbox'" @ok="modalNatureOk"></gms-good-nature-ref>
    <gms-good-recommended-map-ref ref="modalRecommendeds" :selectionType="'checkbox'"
                                  @ok="modalRecommendedOk"></gms-good-recommended-map-ref>

  </a-card>
</template>

<script>

import '@/assets/less/TableExpand.less'
import {mixinDevice} from '@/utils/mixin'
import {JeecgListMixin} from '@/mixins/MyJeecgListMixin'
import {getAction, postAction, putAction} from '@/api/manage'
import GmsGoodModal from './modules/GmsGoodModal'
import JDate from '@/components/jeecg/JDate.vue'
import JDictSelectTag from '@/components/dict/JDictSelectTag'
import GmsLabelRef from '@/views/gospel/mallBase/good/modules/GmsLabelRef'
import GmsGoodNatureRef from '@/views/gospel/mallBase/good/modules/GmsGoodNatureRef'
import GmsGoodRecommendedMapRef from '@/views/gospel/mallBase/good/modules/GmsGoodRecommendedMapRef'
import Vue from "vue";
import {ACCESS_TOKEN, TENANT_ID} from "@/store/mutation-types";

import GmsRangeInfo from '@/views/gospel/mallBase/good/modules/GmsRangeInfo'

export default {
  name: 'GmsGoodList',
  mixins: [JeecgListMixin, mixinDevice],
  components: {
    JDate,
    JDictSelectTag,
    GmsGoodModal,
    GmsLabelRef,
    GmsGoodNatureRef,
    GmsGoodRecommendedMapRef,
    GmsRangeInfo
  },
  data() {
    return {
      select_id: null,
      description: '商品管理页面',
      // 表头
      columns: [
        {
          title: '商品编号',
          align: "center",
          dataIndex: 'itemCode'
        },
        {
          title: "商品状态",
          align: "center",
          dataIndex: "status",
          scopedSlots: {customRender: "statusSlot"}
        },
        {
          title: '图片',
          align: "center",
          dataIndex: 'imgUrl',
          scopedSlots: {customRender: "imgSlot"}
        },
        {
          title: '名称',
          align: "center",
          dataIndex: 'title',
          width: 220,
          scopedSlots: {customRender: "titleSlot"}
        },
        {
          title: '供应商',
          align: "left",
          dataIndex: 'supplierName',
          customRender: function (text) {
            return text ? text : "平台自营"
          }
        },
        {
          title: '现价',
          align: "center",
          dataIndex: 'price',
          sorter: true,
          scopedSlots: {customRender: "numToFixed2Slot"}
        },
        {
          title: '库存',
          align: "center",
          sorter: true,
          dataIndex: 'stock'
        },
        {
          title: '总销量',
          align: "center",
          sorter: true,
          dataIndex: 'dealNum'
        },
        {
          title: '分销比例',
          align: "center",
          sorter: true,
          dataIndex: "rate",
          scopedSlots: {customRender: "rate"}
        },
        {
          title: '排序',
          align: "center",
          dataIndex: 'sequence',
          sorter: true,
          scopedSlots: {customRender: "sequence"}
        },
        {
          title: '货号',
          align: "center",
          dataIndex: 'code'
        },
        {
          title: '商品标签',
          align: "left",
          dataIndex: 'labelNamesList',
          scopedSlots: {customRender: "labelSlot"}
        },
        {
          title: '创建时间',
          align: "center",
          dataIndex: 'createTime',
          sorter: true,
          customRender: function (text) {
            return !text ? "" : (text.length > 10 ? text.substr(0, 10) : text)
          }
        },

        {
          title: '操作',
          dataIndex: 'action',
          align: "left",
          fixed: "right",
          width: 100,
          scopedSlots: {customRender: 'action'}
        }
      ],
      url: {
        list: "/mallBase/gmsGood/zyList",
        delete: "/mallBase/gmsGood/delete",
        editNature: "/mallBase/gmsGood/editNature",
        top: "/mallBase/gmsGood/top",
        deleteBatch: "/mallBase/gmsGood/deleteBatch",
        editStatusBatch: "/mallBase/gmsGood/editStatusBatch",
        editStatus: "/mallBase/gmsGood/editStatus",
        editLabels: "/mallBase/gmsGood/editLabels",
        editLabelsBatch: "/mallBase/gmsGood/editLabelsBatch",
        exportXlsUrl: "/gms/excel/exportXls",
        importExcelSimple: "/mallBase/gmsGoodsImport/importExcelSimple",
      },
      dictOptions: {},
      categoryId1s: [],
      categoryId2s: [],
      categoryId3s: [],
      cateId1s: [],
      cateId2s: [],
      isAddress: false
    }
  },
  created() {
    console.log(this.$route.path)
    // this.isorter = {
    //   column: 'sequence',
    //   order: 'asc',
    // }
    this.queryParam = {
      categoryId1: undefined,
      categoryId2: undefined,
      categoryId3: undefined,
      pcategoryId: undefined,
      categoryId: undefined
    }
    this.loadData()
    this.getcategoryId1s()
    this.getcateId1s()
    this.getDefaultAddr()
  },
  computed: {
    importExcelUrlSimple: function () {
      return `${window._CONFIG['domianURL']}/${this.url.importExcelSimple}`
    },
    importHeader() {
      let head = {'X-Access-Token': Vue.ls.get(ACCESS_TOKEN)}
      //当前用户店铺类型1:平台，2：自营，3：店铺，4：供应商
      let shopType = this.shopType;
      if (shopType) {
        head['shopType'] = shopType;
      }
      //当前用户部门code
      let orgCode = this.orgCode;
      if (orgCode) {
        head['orgCode'] = orgCode;
      }
      return head;
    }
  },
  methods: {
    deleteGoods: function (record) {
      let that = this;
      this.$confirm({
        title: "删除商品提示",
        content: "您确定要删除商品：【" + record.title + "】 ?",
        onOk: function () {
          that.handleDelete(record.id);
        }
      });
    }
    ,
    getDefaultAddr() {
      let self = this
      getAction("/mallBase/omsRefundAddress/list", {
        column: 'isTop',
        order: 'desc',
        pageNo: 1,
        pageSize: 1,
        isTop: 1
      }).then(res => {
        if (res.success) {
          if (res.result.records.length > 0) {
            self.isAddress = true
          }
        } else {
          // self.$message.error(res.message)
        }
      })
    },
    searchReset() {
      this.queryParam = {
        categoryId1: undefined,
        categoryId2: undefined,
        categoryId3: undefined,
        pcategoryId: undefined,
        categoryId: undefined
      }
      this.loadData(1)
    },
    getcategoryId1s() {
      let self = this
      getAction("/mallBase/smsServiceCategory/oneList", {pid: ''}).then(res => {
        if (res.success) {
          this.categoryId1s = res.result
        } else {
          this.$message.error(res.message)
        }
      })
    },
    getcategoryId2sChange(pid) {
      this.queryParam.categoryId2 = undefined
      this.queryParam.categoryId3 = undefined
      this.getcategoryId2s(pid)
    },
    getcategoryId2s(pid) {
      console.log(pid)
      let self = this
      if (pid) {
        getAction("/mallBase/smsServiceCategory/oneList", {pid: pid}).then(res => {
          if (res.success) {
            this.categoryId2s = res.result
          } else {
            this.$message.error(res.message)
          }
        })
      } else {
        this.categoryId2s = []
      }

    },
    getcategoryId3sChange(pid) {
      this.queryParam.categoryId3 = undefined
      this.getcategoryId3s(pid)
    },
    getcategoryId3s(pid) {
      let self = this
      if (pid) {
        getAction("/mallBase/smsServiceCategory/oneList", {pid: pid}).then(res => {
          if (res.success) {
            this.categoryId3s = res.result
          } else {
            this.$message.error(res.message)
          }
        })
      } else {
        this.categoryId3s = []
      }
    },

    getcateId1s() {
      let self = this
      getAction("/mallBase/gmsCategory/oneList", {pid: ''}).then(res => {
        if (res.success) {
          this.cateId1s = res.result
        } else {
          this.$message.error(res.message)
        }
      })
    },
    getcateId2sChange(pid) {
      this.queryParam.categoryId = undefined
      this.getcateId2s(pid)
    },
    getcateId2s(pid) {
      let self = this
      if (pid) {
        getAction("/mallBase/gmsCategory/oneList", {pid: pid}).then(res => {
          if (res.success) {
            this.cateId2s = res.result
          } else {
            this.$message.error(res.message)
          }
        })
      } else {
        this.cateId2s = []
      }

    },
    handlePageAdd() {
      if (this.isAddress) { 
        this.$router.push({path: '/good/mng/GmsGoodEdit', query: {disabled: false}})
      } else {
        this.$message.warning("您尚未设置退货地址，请先设置退货地址后再上传商品")
      }
    },
    handlePageEdit(record) {
      this.$router.push({path: '/good/mng/GmsGoodEdit', query: {id: record.id, disabled: false}})
    },
    handlePageDetail(record) {
      this.$router.push({path: '/good/mng/GmsGoodEdit', query: {id: record.id, disabled: true}})
    },
    remEdit(record) {
      let self = this
      self.$refs.modalRecommendeds.visible = true
      self.$refs.modalRecommendeds.open(record.id)
    },
    modalRecommendedOk() {
    },
    natureEdit(record) {
      let self = this
      self.select_id = record.id
      self.$refs.modalNatures.visible = true
      self.$refs.modalNatures.checkedKeys = []
      self.$refs.modalNatures.checkedRows = record.natureInfoObj
      for (let i = 0; i < record.natureInfoObj.length; i++) {
        self.$refs.modalNatures.checkedKeys.push(record.natureInfoObj[i].id)
      }
      self.$refs.modalNatures.open()
    },
    handleTop(record) {
      var that = this
      putAction(that.url.top, {id: record.id, sequence: 1}).then((res) => {
        if (res.success) {
          that.$message.success(res.message)
          that.loadData()
        } else {
          that.$message.warning(res.message)
        }
      }).finally(() => {
        that.loading = false
      })
    },
    handleCancelTop(record) {
      var that = this
      putAction(that.url.top, {id: record.id, sequence: 1}).then((res) => {
        if (res.success) {
          that.$message.success(res.message)
          that.loadData()
        } else {
          that.$message.warning(res.message)
        }
      }).finally(() => {
        that.loading = false
      })
    },
    modalNatureOk(rows, keys) {
      var that = this
      if (that.select_id) {
        putAction(that.url.editNature, {id: that.select_id, natureInfo: JSON.stringify(rows)}).then((res) => {
          if (res.success) {
            that.$message.success(res.message)
            that.loadData()
            that.onClearSelected()
          } else {
            that.$message.warning(res.message)
          }
        }).finally(() => {
          that.loading = false
        })
      }

    },
    labelEdit(record) {
      let self = this
      self.select_id = record.id
      self.$refs.modalLabels.visible = true
      self.$refs.modalLabels.checkedKeys = record.labelIdsList ? record.labelIdsList : []
      self.$refs.modalLabels.checkedRows = []
      if (record.labelIdsList) {
        for (let i = 0; i < record.labelIdsList.length; i++) {
          self.$refs.modalLabels.checkedRows.push({id: record.labelIdsList[i]})
        }
      }
      self.$refs.modalLabels.open()
    },
    discountEdit(record) {
      let self = this
      self.$refs.rangeDiscount.visible = true;
      self.$refs.rangeDiscount.itemId = record.id;
      self.$refs.rangeDiscount.open()
    },
    labelEditBatch() {
      let self = this
      self.select_id = ''
      self.$refs.modalLabels.visible = true
      self.$refs.modalLabels.checkedKeys = []
      self.$refs.modalLabels.checkedRows = []
      self.$refs.modalLabels.open()
    },
    modalLabelOk(rows, keys) {
      var that = this
      console.log(rows)
      if (that.select_id) {
        postAction(that.url.editLabels, {itemId: that.select_id, labels: rows}).then((res) => {
          if (res.success) {
            that.$message.success(res.message)
            that.loadData()
            that.onClearSelected()
          } else {
            that.$message.warning(res.message)
          }
        }).finally(() => {
          that.loading = false
        })
      } else {
        if (that.selectedRowKeys.length <= 0) {
          that.$message.warning('请选择一条记录！')
          return
        } else {
          var ids = ""
          for (var a = 0; a < that.selectedRowKeys.length; a++) {
            ids += that.selectedRowKeys[a] + ","
          }
        }
        postAction(that.url.editLabelsBatch, {itemIds: ids, labelIds: keys}).then((res) => {
          if (res.success) {
            that.$message.success(res.message)
            that.loadData()
            that.onClearSelected()
          } else {
            that.$message.warning(res.message)
          }
        }).finally(() => {
          that.loading = false
        })
      }

    },
    initDictConfig() {
    },
    isActMsg() {
      this.$message.warning('处于预售活动中，不能上架！')
    },
    //status: 0=下架,1=上架(通过审核),2=提交审核 ,3=违规下架
    batchStatusChange: function (status, str) {
      if (!this.url.editStatusBatch) {
        this.$message.error("请设置url.editStatusBatch!")
        return
      }
      if (this.selectedRowKeys.length <= 0) {
        this.$message.warning('请选择一条记录！')
        return
      } else {
        var ids = ""
        for (var a = 0; a < this.selectedRowKeys.length; a++) {
          ids += this.selectedRowKeys[a] + ","
        }
        var that = this
        this.$confirm({
          title: "确认批量" + str,
          content: "是否批量" + str + "选中数据?",
          onOk: function () {
            that.loading = true
            getAction(that.url.editStatusBatch, {ids: ids, status: status}).then((res) => {
              if (res.success) {
                that.$message.success(res.message)
                that.loadData()
                that.onClearSelected()
              } else {
                that.$message.warning(res.message)
              }
            }).finally(() => {
              that.loading = false
            })
          }
        })
      }
    },
    statusChange: function (status, id, str) {
      if (!this.url.editStatus) {
        this.$message.error("请设置url.editStatus!")
        return
      }
      var that = this
      this.$confirm({
        title: "确认" + str,
        content: "是否" + str + "选中数据?",
        onOk: function () {
          that.loading = true
          getAction(that.url.editStatus, {id: id, status: status}).then((res) => {
            if (res.success) {
              that.$message.success(res.message)
              that.loadData()
            } else {
              that.$message.warning(res.message)
            }
          }).finally(() => {
            that.loading = false
          })
        }
      })

    },
  }
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>
